using System.ComponentModel.DataAnnotations;

namespace KnowledgeQA.Models.Entities
{
    /// <summary>
    /// 文档实体类
    /// </summary>
    public class Document : BaseEntity
    {
        /// <summary>
        /// 文档标题
        /// </summary>
        [Required]
        [MaxLength(200)]
        public string Title { get; set; } = string.Empty;

        /// <summary>
        /// 文档描述
        /// </summary>
        [MaxLength(1000)]
        public string? Description { get; set; }

        /// <summary>
        /// 文档内容
        /// </summary>
        public string Content { get; set; } = string.Empty;

        /// <summary>
        /// 文件名
        /// </summary>
        [MaxLength(255)]
        public string? FileName { get; set; }

        /// <summary>
        /// 文档类型（PDF、Word、Excel、TXT等）
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string FileType { get; set; } = string.Empty;

        /// <summary>
        /// 文件大小（字节）
        /// </summary>
        public long FileSize { get; set; }

        /// <summary>
        /// 文件路径
        /// </summary>
        [MaxLength(500)]
        public string? FilePath { get; set; }

        /// <summary>
        /// 文档分类ID
        /// </summary>
        public int? CategoryId { get; set; }

        /// <summary>
        /// 文档分类
        /// </summary>
        public virtual Category? Category { get; set; }

        /// <summary>
        /// 文档标签（JSON格式存储）
        /// </summary>
        [MaxLength(1000)]
        public string? Tags { get; set; }

        /// <summary>
        /// 处理状态（Pending、Processing、Completed、Failed）
        /// </summary>
        [MaxLength(20)]
        public string Status { get; set; } = "Pending";

        /// <summary>
        /// 错误信息
        /// </summary>
        [MaxLength(2000)]
        public string? ErrorMessage { get; set; }

        /// <summary>
        /// 向量化状态
        /// </summary>
        public bool IsVectorized { get; set; } = false;

        /// <summary>
        /// 处理时间（毫秒）
        /// </summary>
        public long? ProcessingTime { get; set; }

        /// <summary>
        /// 文档块数量
        /// </summary>
        public int ChunkCount { get; set; } = 0;

        /// <summary>
        /// 文档块列表
        /// </summary>
        public virtual ICollection<DocumentChunk> DocumentChunks { get; set; } = new List<DocumentChunk>();

        /// <summary>
        /// 文档版本
        /// </summary>
        public int Version { get; set; } = 1;
    }
} 